package com.maxatime.redis;

import redis.clients.jedis.Jedis;

public class RedisJava {
	
	
	public static void main(String[] args) {
		// Connecting to Redis server on localhost
		Jedis jedis = new Jedis("127.0.0.1", 6379);//链接redis数据库
		jedis.auth("redis.12345678");//设置密码
		System.out.println("Connection to server sucessfully");
		// check whether server is running or not
		System.out.println("Server is running: " + jedis.ping());
		jedis.set("Ssb", "123456");//数据
		jedis.expire("Ssb", 5);//定时销毁
		System.out.println("get:::: " + jedis.get("Ssb"));
	}
	
}